package com.yizn.kafka.springboot;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * project : my-learn
 * <p>  </p>
 *
 * @author yisl
 * @date 2023-01-11【星期三】
 **/
@RestController
public class KafkaController {
    private final static String TOPIC_NAME="my-replicated-topic";
    @Autowired
    private KafkaTemplate<String,String> kafkaTemplate;
    @RequestMapping("/send")
    public void send(){
        kafkaTemplate.send(TOPIC_NAME, 0, "key", "this is message");
    }

}
